import axios from "axios";

// 列表接口
export function getUserList(params) {
  return axios({
    url: "http://localhost:3001/data",
    method: "get",
    params,
  });
}

// 新增接口
export function addUser(data) {
  return axios({
    url: "http://localhost:3001/data",
    method: "post",
    data,
  });
}

// 编辑接口
export function editUser(data) {
  return axios({
    url: `http://localhost:3001/data/${data.id}`,
    method: "put",
    data,
  });
}

// 详情接口
export function getDetail(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: "get",
  });
}

// 删除接口
export function delUser(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: "delete",
  });
}

// 搜索接口
export function searchUser(name) {
  return axios({
    url: `http://localhost:3001/data/?name=${name}`,
    method: "get",
  });
}
